//
//  UIView+Hierarchy.m
//  Tool
//
//  Created by 唐可雄 on 2019/7/22.
//  Copyright © 2019 swustyc. All rights reserved.
//

#import "UIView+Hierarchy.h"

@implementation UIView (Hierarchy)

- (UIViewController *)currentViewController {
    if (self.nextResponder) {
        if ([self.nextResponder isKindOfClass:[UIViewController class]]) {
            return (UIViewController *)self.nextResponder;
        } else {
            return [self currentViewController];
        }
    } else {
        return nil;
    }
}

@end
